C#: Replace SSA classes with shared code.#21762
Open
aschackmull wants to merge 28 commits intogithub:mainfrom
Open
C#: Replace SSA classes with shared code.#21762aschackmull wants to merge 28 commits intogithub:mainfrom
aschackmull wants to merge 28 commits intogithub:mainfrom
Conversation
ef22df2 to
7b3cdc8
Compare
7b3cdc8 to
ff8ab19
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the C# SSA library to the shared SSA signature by switching C# SSA consumers to shared SSA classes (for example SsaDefinition, SsaExplicitWrite, SsaPhiDefinition) and deprecating the legacy C#-specific SSA wrapper classes.
Changes:
- Update shared SSA
toString()for SSA definitions (including phi definitions) to match the shared formatting. - Rework the C# SSA library surface to expose shared SSA types and add migration helpers (for example
Ssa::ssaGetAFirstUse), while deprecating legacy types/APIs. - Bulk-update C# queries and test queries/expectations to the new SSA API and renamed classes.
Show a summary per file
| File | Description |
|---|---|
| shared/ssa/codeql/ssa/Ssa.qll | Adjust SSA definition/phi toString() formatting in the shared SSA library. |
| csharp/ql/test/library-tests/dataflow/ssa/SsaUltimateDef.ql | Update test query to use shared SSA definition types. |
| csharp/ql/test/library-tests/dataflow/ssa/SsaUltimateDef.expected | Update expected output for renamed SSA types / locations. |
| csharp/ql/test/library-tests/dataflow/ssa/SsaRead.ql | Update test query to use SsaDefinition. |
| csharp/ql/test/library-tests/dataflow/ssa/SsaRead.expected | Update expected output for shared SSA API changes. |
| csharp/ql/test/library-tests/dataflow/ssa/SsaImplicitQualifier.expected | Update expected output for qualifier SSA behavior/printing changes. |
| csharp/ql/test/library-tests/dataflow/ssa/SsaImplicitParameterDef.ql | Update test query to use SsaParameterInit. |
| csharp/ql/test/library-tests/dataflow/ssa/SsaExplicitDef.ql | Update test query to use SsaExplicitWrite and new accessor names. |
| csharp/ql/test/library-tests/dataflow/ssa/SsaExplicitDef.expected | Update expected output for explicit write changes. |
| csharp/ql/test/library-tests/dataflow/ssa/SsaDefElement.ql | Remove obsolete test query relying on legacy SSA API. |
| csharp/ql/test/library-tests/dataflow/ssa/SsaDefElement.expected | Remove corresponding obsolete expected file. |
| csharp/ql/test/library-tests/dataflow/ssa/SsaDef.ql | Update test query to use SsaDefinition. |
| csharp/ql/test/library-tests/dataflow/ssa/SsaDef.expected | Update expected output for SsaDefinition output changes. |
| csharp/ql/test/library-tests/dataflow/ssa/SSAPhi.ql | Update phi test query to use SsaPhiDefinition/SsaDefinition. |
| csharp/ql/test/library-tests/dataflow/ssa/SSAPhi.expected | Update expected output for phi definition formatting/locations. |
| csharp/ql/test/library-tests/dataflow/ssa/IsLiveOutRefParameterDefinition.ql | Switch from method call to Ssa::isLiveOutRefParameterDefinition(def, p) helper. |
| csharp/ql/test/library-tests/dataflow/ssa/DefAdjacentRead.expected | Update expected output for SSA adjacency results after migration. |
| csharp/ql/test/library-tests/dataflow/ssa/BaseSsaConsistency.ql | Update SSA consistency test to use shared write types. |
| csharp/ql/test/library-tests/dataflow/ssa-large/countssa.ql | Update SSA large-count test to use SsaExplicitWrite. |
| csharp/ql/test/library-tests/dataflow/local/TaintTrackingStep.expected | Update expected taint-tracking steps for shared SSA API changes. |
| csharp/ql/test/library-tests/dataflow/local/DataFlowStep.expected | Update expected data-flow steps for shared SSA API changes. |
| csharp/ql/test/library-tests/dataflow/defuse/useUseEquivalence.ql | Update def/use equivalence test to shared SSA types and helper for first use. |
| csharp/ql/test/library-tests/dataflow/defuse/parameterUseEquivalence.ql | Update parameter-use equivalence test to SsaParameterInit. |
| csharp/ql/test/library-tests/dataflow/defuse/defUseEquivalence.ql | Update def/use equivalence test to shared explicit write type/accessors. |
| csharp/ql/test/library-tests/dataflow/callablereturnsarg/Common.qll | Update out/ref tracking helper to shared SSA write types and predicates. |
| csharp/ql/test/library-tests/csharp7/LocalTaintFlow.expected | Update expected flow steps for SSA locations/formatting changes. |
| csharp/ql/test/library-tests/csharp7/DefUse.ql | Update C#7 def/use test to shared SSA definition types. |
| csharp/ql/src/Likely Bugs/Dynamic/BadDynamicCall.ql | Update query to shared SSA types/accessors to resolve ultimate definition. |
| csharp/ql/src/Dead Code/DeadStoreOfLocal.ql | Update query to treat SSA explicit writes via SsaExplicitWrite. |
| csharp/ql/src/Bad Practices/Control-Flow/ConstantCondition.ql | Switch constant-condition integration to shared SSA definition class reference. |
| csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SsaUtils.qll | Update range analysis SSA utilities to shared SSA types and accessors. |
| csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SsaReadPositionSpecific.qll | Update SSA type aliases to CS::SsaDefinition / CS::SsaPhiDefinition. |
| csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SignAnalysisSpecific.qll | Update sign analysis SSA types and explicit write handling to shared SSA API. |
| csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/RangeUtils.qll | Update range utilities to shared SSA definition types. |
| csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/ModulusAnalysisSpecific.qll | Update modulus analysis to use shared SsaPhiDefinition. |
| csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll | Refactor C# SSA implementation to use shared SsaImplCommon input signature and provide deprecated compatibility shims. |
| csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll | Update internal data-flow SSA integration points to shared SSA types and helper predicates. |
| csharp/ql/lib/semmle/code/csharp/dataflow/internal/BaseSSA.qll | Restructure BaseSSA to expose SSA via shared implementation modules. |
| csharp/ql/lib/semmle/code/csharp/dataflow/SSA.qll | Re-export shared SSA API from the public C# SSA library; add migration helper(s) and deprecations. |
| csharp/ql/lib/semmle/code/csharp/dataflow/Nullness.qll | Update nullness analysis to shared SSA types and new first-use logic. |
| csharp/ql/lib/semmle/code/csharp/controlflow/Guards.qll | Simplify guard SSA integration by importing Ssa rather than duplicating SSA wrapper classes. |
| csharp/ql/lib/semmle/code/csharp/controlflow/ControlFlowReachability.qll | Switch reachability integration to import Ssa shared SSA types. |
| csharp/ql/lib/semmle/code/csharp/Assignable.qll | Update AssignableDefinition.getAFirstRead implementation to use Ssa::ssaGetAFirstUse. |
| csharp/ql/lib/change-notes/2026-05-01-ssa-replacement.md | Add change note documenting SSA rename/deprecation and migration guidance location. |
| csharp/ql/consistency-queries/SsaConsistency.ql | Update consistency query to use SsaExplicitWrite and new accessors. |
Copilot's findings
- Files reviewed: 45/45 changed files
- Comments generated: 1
| } | ||
|
|
||
| /** | ||
| * Allows for flow into uncertain defintions that are not call definitions, |
There was a problem hiding this comment.
Typo in the doc comment: "defintions" should be "definitions".
Suggested change
| * Allows for flow into uncertain defintions that are not call definitions, | |
| * Allows for flow into uncertain definitions that are not call definitions, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This aligns the C# SSA classes with the shared SSA signature by using the classes provided by the shared library.